﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Practice.PH4_2104A.DAL.Migrations
{
    public partial class addtableorder : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "tb_order_detail",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    OrderNo = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    SkuId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Price = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    Number = table.Column<int>(type: "int", nullable: false),
                    Image = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    State = table.Column<string>(type: "nvarchar(max)", nullable: true,defaultValue:"0")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_order_detail", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "tb_order_master",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false,defaultValueSql:"newid()"),
                    MemberId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    RecivedName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    RecivedPhone = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    RecivedAddress = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    OrderNo = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    OrderTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    OrderAmount = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    RateAmount = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    OrderState = table.Column<int>(type: "int", nullable: false,defaultValue:0),
                    Remark = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    PayTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    PayAmount = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
                    PayType = table.Column<int>(type: "int", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false,defaultValue:false),
                    CreatedDate = table.Column<DateTime>(type: "datetime2", nullable: false,defaultValueSql:"getdate()"),
                    CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    LastModifiedDate = table.Column<DateTime>(type: "datetime2", nullable: true),
                    LastModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_tb_order_master", x => x.Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "tb_order_detail");

            migrationBuilder.DropTable(
                name: "tb_order_master");
        }
    }
}
